/*  Keypadtest.pde
 *
 *  Demonstrate the simplest use of the  keypad library.
 *
 *  The first step is to connect your keypad to the
 *  Arduino  using the pin numbers listed below in
 *  rowPins[] and colPins[]. If you want to use different
 *  pins then  you  can  change  the  numbers below to
 *  match your setup.
 *
 */
#include <Keypad.h>

const byte ROWS = 8; // Four rows
const byte COLS = 8; // Three columns
// Define the Keymap
char keys[ROWS][COLS] = {
  {'-','*','Ö','K','H','F','S','r'},
  {'-','-','-',',','N','V','X','-'},
  {'t','.',':','M','B','C','Z','-'},
  {'.','Ä','L','J','G','D','A','-'},
  {'.','u','P','I','Y','R','W','-'},
  {'.','-','9','7','5','3','1','-'},
  {'.','Å','O','U','T','E','Q','t'},
  {'.','-','0','8','6','4','2','t'}
};
// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = { 21,22,23,24,25,26,27,28};
// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[COLS] = { 29,30,31,32,33,34,35,36 }; 

// Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

#define ledpin 13

void setup()
{
  pinMode(ledpin,OUTPUT);
  digitalWrite(ledpin, HIGH);
  Serial.begin(9600);
  kpd.setDebounceTime(1);
}

void loop()
{
  char key = kpd.getKey();
  if(key)  // Check for a valid key.
  {
    switch (key)
    {
      case '*':
        digitalWrite(ledpin, LOW);
        break;
      case '#':
        digitalWrite(ledpin, HIGH);
        break;
      default:
        Serial.print(key);
    }
  }
}
